<?php
/**
 * MessageStack helper
 * @uses viewHelper Zend_View_Helper
 */
class Zend_View_Helper_MessageStack extends Zend_View_Helper_Abstract {

    public $view;

    public function messageStack($messages) {
        $translate = Zend_Registry::get('Zend_Translate');
        $msg = '';
        if (count($messages) > 0) {
            foreach ($messages as $message) {
                $msg .= '<div class="message ' . $message['type'] . '"><p>' . $translate->_($message['text']) . '</p></div>' . "\n";
            }
        }
        return $msg;
    }

    public function setView(Zend_View_Interface $view) {
        $this->view = $view;
    }
}